<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
exit();
$strWeb = $_SERVER[argv][1];
$_SERVER["DOCUMENT_ROOT"] = "/home/share/www/".$strWeb."/secure";
$strError = $strWeb."  (".date("Y-m-d H:i:s").")\n";
$strError .= "===========================================\n";

$_isDBExist = "no";
$_DBSite = "Master";
if(!file_exists($_SERVER["DOCUMENT_ROOT"]."/config.inc.php"))exit($strError." no config.inc.php");
include("/home/share/www/SourceSite-utf8/secure/config.inc.php");
include(__Root_Path."/config.inc.php");
include(__DBConnect_File);
include(__Root_Path."/common/Lotto.inc.php");
include(__Root_Path."/modules/Tool.lib.php");
include(__Root_Path."/modules/BetLimit.lib.php");
include(__Root_Path."/modules/Lotto.lib.php");
include(__Root_Path."/modules/LogRecord.lib.php");

if($_strLogErr != ""){
	@mysql_close($$_Conn);
	exit($strError.$strLogError.$_strLogErr);
}
if(!preg_match("/utf8/i", $_blDBName))exit($strError." no UTF8 DB");


$strPayupDate = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 28, date("Y")));//'2009-12-15';
$strError .= "PayupDate => ".$strPayupDate."\n\n";

$arrTT['61'] = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
$arrTT['67'] = array(0, 1);
$arrTT['90'] = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
$arrTT['93'] = array(0, 1, 2);
for($intLID = 2; $intLID <= 3; $intLID++){
	foreach($arrTT as $strBT => $arrTT2){
		foreach($arrTT2 as $k => $intAN){
			$strSQL = "select preOdds from `bet_LottoBetParam` where LottoID = ".$intLID." and Bet_Type = ".$strBT." and ApointNum = ".$intAN." LIMIT 1";
			if(!$RS = PMA_mysql_query($strSQL, $$_Conn)){
				$GLOBALS["errormessage"] = "Find Data Error!";
				$GLOBALS["errorhidden"] = "SQL: ".$strSQL.", \nError: ".PMA_mysql_error($$_Conn).", \nLine: ".__LINE__.", \nPage: ".__FILE__;
				$strError .= $GLOBALS["errormessage"]."<br>\n";
				$strError .= $GLOBALS["errorhidden"]."<br>\n";
			}

			while($Rows = PMA_mysql_fetch_object($RS)){
				$arrPreOdds = explode(",", $Rows -> preOdds);
				$strSQL = "update `bet_LottoBetParam` set preOdds = '".$arrPreOdds[$intAN]."' where LottoID = ".$intLID." and Bet_Type = ".$strBT." and ApointNum = ".$intAN;
				if(!PMA_mysql_query($strSQL, $$_Conn)){
					$GLOBALS["errormessage"] = "Update Data Error!";
					$GLOBALS["errorhidden"] = "SQL: ".$strSQL.", \nError: ".PMA_mysql_error($$_Conn).", \nLine: ".__LINE__.", \nPage: ".__FILE__;
					$strError .= $GLOBALS["errormessage"]."<br>\n";
					$strError .= $GLOBALS["errorhidden"]."<br>\n";
				}
			}
		}
	}
}

//產生 Lotto 下注參數檔案
foreach($_arrLotto as $intLID => $arrLotto){
	if(!MakeBetParamFileByLID($intLID, $arrLotto["LType"])){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}else{
		$strError .= "BetParam OK!\n";
	}
}

@mysql_close($$_Conn);
print $strError."\nEnd\n";
?>